#!/usr/bin/env python
#coding=utf-8

a = 600851475143
b = 0L
i = 3L
while i < a:
    i += 2
    if a%i == 0:
        a = a/i
        b = b if b>i else i
        i -= 2

print b